﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfApp1
{
    /// <summary>
    /// Task_1.xaml 的交互逻辑
    /// </summary>
    public partial class Task_1 : Window
    {
        public Task_1()
        {
            InitializeComponent();
            this.Loaded += XTask_Loaded;
        }

        private async void XTask_Loaded(object sender, RoutedEventArgs e)
        {

            System.Diagnostics.Trace.WriteLine(1);
            var x = await Test1Async();
            System.Diagnostics.Trace.WriteLine("2");

        }

        public async Task<string> Test1Async()
        {
            await Task.Delay(3000);
            System.Diagnostics.Trace.WriteLine("Async method completed.");
            return "h";
        }
    }
}
